package easy;

public class Solution_1556 {

    public String thousandSeparator(int n) {
        if (n==0) {
            return "0";
        }
        StringBuffer buffer = new StringBuffer();
        int count = 0;
        while (n > 0) {
            if (count == 3) {
                buffer.append(".");
                count = 0;
            }
            int mod = n % 10;
            buffer.append(mod);
            n /= 10;
            count++;
        }
        return buffer.reverse().toString();
    }

    public static void main(String[] args) {
        Solution_1556 model = new Solution_1556();
        System.out.println(model.thousandSeparator(987));
        System.out.println(model.thousandSeparator(1234));
        System.out.println(model.thousandSeparator(123456789));
        System.out.println(model.thousandSeparator(0));
    }
}
